import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

/**
 * @author gao
 * @date 2025/11/3 23:51
 */

public class Solution {

    int aim = 0;
    List<Integer> path;
    List<List<Integer>> ret;

    public List<List<Integer>> combinationSum(int[] candidates, int target) {
        aim = target;
        path = new ArrayList<>();
        ret = new ArrayList<>();

        dfs(candidates, 0, 0);
        return ret;
    }

    private void dfs(int[] candidates, int pos, int sum) {
        if (sum == aim) {
            ret.add(new ArrayList<>(path));
            return;
        }

        if (sum > aim || pos == candidates.length) {
            return;
        }

        // 遍历当前数字的可能使用次数
        for (int k = 0; k * candidates[pos] + sum <= aim; k++) {
            // 如果不是第一次使用当前数字，则将其加入路径
            if (k != 0) {
                path.add(candidates[pos]);
            }
            dfs(candidates, pos + 1, sum + k * candidates[pos]);
        }

        for (int k = 1; k * candidates[pos] + sum <= aim; k++) {
            path.remove(path.size() - 1);
        }
    }


    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        while (in.hasNext()) {
            int n = in.nextInt();
            int[] nums = new int[n];
            for (int i = 0; i < n; i++) {
                nums[i] = in.nextInt();
            }
            int target = in.nextInt();
            Solution solution = new Solution();
            System.out.println(solution.combinationSum(nums, target));
        }
    }
}